package com.my.h2;

import com.my.h2.test.H2JpaController;
import com.my.h2.test.User;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;

/**
 * @author timo 2021/3/11
 */
@Configuration
@PropertySource( ignoreResourceNotFound = true,encoding = "UTF-8" ,value = "classpath:h2-defal-db.properties")
@EnableJpaRepositories(basePackages = { "com.my.h2.test" }) //这个是jpa repository的包的路径
@EntityScan("com.my.h2.test") //不在一个项目中需要配置
public class H2DbConfiguration {

    @Bean
    public User user() {
        return new User();
    }

    @Bean
    public H2JpaController h2JpaController() {
        return new H2JpaController();
    }



}
